#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 crane <crane@crane-pc>
#
# Distributed under terms of the MIT license.

"""

"""


class Solution:
    """
    @param str: An array of char
    @param offset: An integer
    @return: nothing
    """
    def rotateString(self, text, offset):
        # print(text)
        # print(offset)
        if (not text) or (not offset):
            return

        l = len(text)
        if offset > l:
            offset %= l

        # print(text[-offset:])
        # print(text[0:l-offset])

        results = text[-offset:] + text[0:l-offset]

        for i, value in enumerate(results):
            text[i] = value

    # def rotateString(self, text, offset):
    #     results = list(text)

    #     # print(text)
    #     # print(offset)

    #     # l = len(text)

    #     # print(text[-offset:])
    #     # print(text[0:l-offset])
    #     for i in text:
    #         results.append( (i+) )

    #     return text[-offset:] + text[0:l-offset]

def main():
    print("start main")

    s = Solution()
    # r = s.mergeSortedArray([1,2,3], [2,3,5])
    # r = s.mergeSortedArray([3], [2,3,5])
    r = s.rotateString('abcdefg', 3)

    print(r)

if __name__ == "__main__":
    main()
